package recomendadorWeb;

import java.util.Hashtable;
import recomendadorWeb.Traza.TipoTraza;
import testTemp.Temperamento;

public class TablaGeneroTemperamento3 {
	
	private Hashtable<String, PorcentajeTemperamento[]> tabla;
	
	public TablaGeneroTemperamento3(){
			tabla=new Hashtable<String, PorcentajeTemperamento[]>();
			meteGenero(Generos.Accion,			0.1878,	0.0743,	0.0000,	0.0000);
			meteGenero(Generos.Animacion,		0.0000,	0.0000,	0.0000,	0.0000);
			meteGenero(Generos.Aventuras,		0.2086,	0.0000,	0.0831,	0.0000);
			meteGenero(Generos.Comedia,			0.0000,	0.09,	0.1184,	0.0000);
			meteGenero(Generos.Documental,		0.0000,	0.0609,	0.0000,	0.0810);
			meteGenero(Generos.Drama,			0.0000,	0.1520,	0.1309,	0.0000);
			meteGenero(Generos.Fantasia,		0.12,	0.0000,	0.0982,	0.0000);
			meteGenero(Generos.Romantica,		0.0000,	0.0972,	0.1870,	0.0000);
			meteGenero(Generos.Terror,			0.1156,	0.0617,	0.0000,	0.0000);
			meteGenero(Generos.Thriller,		0.0000,	0.1446,	0.0000,	0.0887);
			meteGenero(Generos.CienciaFiccion,	0.0000,	0.0000,	0.0618,	0.2159);
					
		
		ArrTrazasVars.arrTrazasVars.add(new TrazaVars(1,ArrTrazas.arrTrazas.size()+1,"TablaGeneroTemperamento3",7,tabla, IO.INOUT));
		
		ArrTrazas.arrTrazas.add(new Traza(TipoTraza.VARIABLE,"TGT3-0",1,"TablaGeneroTemperamento3", "TablaGeneroTemperamento3()", 
		"Accion -> 0.1878,0.0743,0.0540,0.0202"));
		ArrTrazas.arrTrazas.add(new Traza(TipoTraza.VARIABLE,"TGT3-1",1,"TablaGeneroTemperamento3", "TablaGeneroTemperamento3()", 
		"Animacion -> 0.1266,0.0411,0.1028,0.1012"));
		ArrTrazas.arrTrazas.add(new Traza(TipoTraza.VARIABLE,"TGT3-2",1,"TablaGeneroTemperamento3", "TablaGeneroTemperamento3()", 
		"Aventuras -> 0.2086,0.0583,0.0831,0.0488"));
		ArrTrazas.arrTrazas.add(new Traza(TipoTraza.VARIABLE,"TGT3-3",1,"TablaGeneroTemperamento3", "TablaGeneroTemperamento3()", 
		"Comedia -> 0.0826,0.09,0.1184,0.0707"));
		ArrTrazas.arrTrazas.add(new Traza(TipoTraza.VARIABLE,"TGT3-4",1,"TablaGeneroTemperamento3", "TablaGeneroTemperamento3()", 
		"Documental -> 0.0203,0.1509,0.0717,0.1710"));
		ArrTrazas.arrTrazas.add(new Traza(TipoTraza.VARIABLE,"TGT3-5",1,"TablaGeneroTemperamento3", "TablaGeneroTemperamento3()", 
		"Drama -> 0.0191,0.1520,0.1309,0.099"));
		ArrTrazas.arrTrazas.add(new Traza(TipoTraza.VARIABLE,"TGT3-6",1,"TablaGeneroTemperamento3", "TablaGeneroTemperamento3()", 
		"Fantasia -> 0.12,0.0816,0.0982,0.0668"));
		ArrTrazas.arrTrazas.add(new Traza(TipoTraza.VARIABLE,"TGT3-7",1,"TablaGeneroTemperamento3", "TablaGeneroTemperamento3()", 
		"Romantica -> 0.0348,0.0972,0.1870,0.0636"));
		ArrTrazas.arrTrazas.add(new Traza(TipoTraza.VARIABLE,"TGT3-8",1,"TablaGeneroTemperamento3", "TablaGeneroTemperamento3()", 
		"Terror -> 0.1156,0.0617,0.0303,0.054"));
		ArrTrazas.arrTrazas.add(new Traza(TipoTraza.VARIABLE,"TGT3-9",1,"TablaGeneroTemperamento3", "TablaGeneroTemperamento3()", 
		"Thriller -> 0.0464,0.1446,0.0618,0.0887"));
		ArrTrazas.arrTrazas.add(new Traza(TipoTraza.VARIABLE,"TGT3-10",1,"TablaGeneroTemperamento3", "TablaGeneroTemperamento3()", 
		"CienciaFiccion -> 0.0382,0.0483,0.0618,0.2159"));
	}
	
	private void meteGenero(Generos genero,double artesano, double guardian, double idealista, double racional){
		PorcentajeTemperamento[] v=new PorcentajeTemperamento[4];	
		v[0]=new PorcentajeTemperamento(Temperamento.Artesano,artesano);
		v[1]=new PorcentajeTemperamento(Temperamento.Idealista,idealista);
		v[2]=new PorcentajeTemperamento(Temperamento.Guardian,guardian);
		v[3]=new PorcentajeTemperamento(Temperamento.Racional,racional);
		tabla.put(genero.toString(), v);
	}
	
	public double getValorTabla(Generos genero, Temperamento temperamento){
		double valor=getPorcentajeTemperamentoTabla((PorcentajeTemperamento[]) tabla.get(genero.toString()), temperamento);
		return valor;
	}

	private double getPorcentajeTemperamentoTabla(PorcentajeTemperamento[] temps, Temperamento temperamento) {
		double valor=0;
		switch (temperamento){
		case Artesano: valor=temps[0].getPorcentaje();break;
		case Idealista: valor=temps[1].getPorcentaje();break;
		case Guardian: valor=temps[2].getPorcentaje();break;
		case Racional:valor=temps[3].getPorcentaje();break;
		}
		return valor;
	}
}